<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::post('goods/{id}', 'AdminController@getGoods');
Route::post('admin', 'AdminController@index');

Route::middleware(['auth:api'])->group(function () {
    Route::group(    [
        'namespace' => 'Admin',
        'prefix' => 'admin'
    ], function ($router) {
        Route::get('export','ExcelController@export');
        Route::post('import','ExcelController@import');
        Route::post('data/index','DataController@index');
        //用户相关
        Route::post('member/index','MemberController@index');
        Route::post('member/import','MemberController@import');
        Route::get('member/export','MemberController@export');
        Route::post('member/destroy/{id}','MemberController@destroy');

        


    });

});


Route::group(    [
    'namespace' => 'Admin',
    'prefix' => 'admin'
], function ($router) {
    //data相关
    Route::post('data/uploadImg','DataController@uploadImg');
    Route::post('data/uploadVideo','DataController@uploadVideo');
    Route::post('data/select','DataController@select');
    Route::post('data/getAccessToken','DataController@getAccessToken');
    Route::post('data/add','DataController@create');
    Route::post('data/info','DataController@getInfo');


    //Store  模块
    Route::get('store/index','StoreController@index');
    Route::get('store/getProductInfo','StoreController@getProductInfo');
    Route::get('store/getBanner','StoreController@getBanner');
    Route::post('store/getStoreData/{id}','StoreController@getStoreData');
    Route::post('store/addStore','StoreController@addStore');
    Route::post('store/delete/{id}','StoreController@delete');

    //配置接口
    Route::post('config/index','StoreController@configIndex');







});






/**
 * 后台路由
 */

/**后台模块**/
Route::group(['namespace' => 'Admin','prefix' => 'admin'], function (){
    /**需要登录认证模块**/
    Route::middleware(['auth:admin','rbac'])->group(function (){

        Route::resource('index', 'IndexsController', ['only' => ['index']]);  //首页

        Route::get('index/main', 'IndexsController@main')->name('index.main'); //首页数据分析

        Route::get('admins/status/{statis}/{admin}','AdminsController@status')->name('admins.status');

        Route::get('admins/delete/{admin}','AdminsController@delete')->name('admins.delete');

        Route::resource('admins','AdminsController',['only' => ['index', 'create', 'store', 'update', 'edit']]); //管理员

        Route::get('roles/access/{role}','RolesController@access')->name('roles.access');

        Route::post('roles/group-access/{role}','RolesController@groupAccess')->name('roles.group-access');

        Route::resource('roles','RolesController',['only'=>['index','create','store','update','edit','destroy'] ]);  //角色

        Route::get('rules/status/{status}/{rules}','RulesController@status')->name('rules.status');

        Route::resource('rules','RulesController',['only'=> ['index','create','store','update','edit','destroy'] ]);  //权限

        Route::resource('actions','ActionLogsController',['only'=> ['index','destroy'] ]);  //日志
    });
});


